﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using nwrole.plugin;

namespace nwrole.lib {
    [ServiceContract(CallbackContract = typeof(IOrchestratorClientContract))]
    public interface IOrchestratorContract {
        [OperationContract]
        void RegisterSupervisor(Guid supervisorId, string displayName);

        [OperationContract]
        void RegisterService(Guid supervisorId, Guid serviceId, string name);

        [OperationContract]
        void RegisterPlugin(Guid serviceId, Guid pluginId, string displayName);

        /*[OperationContract]
        void LogSupervisor(Guid supervisorId, LogLevel level, string msg, Exception ex);

        [OperationContract]
        void LogService(Guid serviceId, LogLevel level, string msg, Exception ex);

        [OperationContract]
        void LogPlugin(Guid pluginId, LogLevel level, string msg, Exception ex);*/

        [OperationContract]
        void Log(NwroleObjectType? objectType, Guid? objectId, LogLevel level, string message, Exception ex);
    }

    public interface IOrchestratorChannel : IOrchestratorContract, IClientChannel { }

    public interface IOrchestratorClientContract {
        /*[OperationContract]
        int GetNumServices();*/

        /*[OperationContract]
        Guid GetIdentifier();*/

        [OperationContract]
        Result Start();

        [OperationContract]
        Result Stop();

        [OperationContract]
        SupervisorData GetSupervisorData();

        [OperationContract]
        ServiceData[] GetServices();

        [OperationContract]
        Result RestartService(Guid serviceId);

        [OperationContract]
        Result StopService(Guid serviceId);

        [OperationContract]
        Result StartService(Guid serviceId);

        [OperationContract]
        PluginData[] GetServicePluginsData(Guid serviceId);

        [OperationContract]
        PluginState? GetServicePluginState(Guid serviceId, Guid pluginId);
    }
}


